package operation;

import book.Book;
import book.BookList;

/**
 * @program: 11.22
 * @description:
 * @author: 李鑫月
 * @create: 2021-11-22 21:20
 **/
public class FindOperation implements IOperation{
    public void work(BookList bookList){
        System.out.println("查找图书");
        System.out.println("请输入你要查找的图书：");
        String name=scanner.nextLine();
        int size=bookList.getUsedsize();
        for (int i = 0; i <size ; i++) {
            Book book=bookList.getposbook(i);
            if(book.getName().equals(name)){
                System.out.println("找到了：信息如下：");
                System.out.println(book);
                return;
            }
        }
        System.out.println("没有找到");
    }
}
